#!/bin/bash
 
source make_sandbox.cfg
 
IFS=$'\n';

echo '# step 4: rewrite wp-config.php >>> BEGIN';
# ============================================================
# step 4: rewrite wp-config.php
# ============================================================
 
echo "rewriting wp-config.php with new information";
 
sed \
	"s/'DB_NAME', '${SOURCE_DATABASE}'/'DB_NAME', '${DESTINATION_DATABASE}'/g" \
		${SOURCE_FOLDER}wp-config.php | \
sed \
	"s/'DB_USER', '${SOURCE_DATABASE_USER}'/'DB_USER', '${DESTINATION_DATABASE_USER}'/g" | \
sed \
	"s/'DB_PASSWORD', '${SOURCE_DATABASE_PASS}'/'DB_PASSWORD', '${DESTINATION_DATABASE_PASS}'/g" | \
sed \
	"s/'DOMAIN_CURRENT_SITE', '${SOURCE_SITE}'/'DOMAIN_CURRENT_SITE', '${DESTINATION_SITE}'/g" \
	> ${DESTINATION_FOLDER}wp-config.php

echo '# step 4: rewrite wp-config.php >>> END';
